package com.umgsai.thread.thread36;

import java.io.PipedInputStream;
import java.io.PipedReader;

public class ReadData {
	public void readMethod(PipedReader reader) {
		try {
			System.out.println("read:");
			char[] array = new char[20];
			int readLength = reader.read(array);
			while (readLength != -1) {
				String newData = new String(array, 0, readLength);
				System.out.println(newData);
				readLength = reader.read(array);
			}
			System.out.println();
			reader.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
